package com.yilu.driver.mvp.presenter;


import android.content.Context;

import com.is.common.retrofitrxcache.RxCacheResult;
import com.is.common.rx.RxSubscriber;
import com.yilu.driver.entity.ApplyGraduationResponse;
import com.yilu.driver.entity.StageGraduationResponse;
import com.yilu.driver.mvp.contract.StageGraduationContract;

import org.json.JSONObject;


/**
 * 阶段结业
 *
 * @author Administrator
 * @date 2017/4/13 0013
 */

public class StageGraduationPresenter extends StageGraduationContract.Presenter {
    private Context mContext;

    public StageGraduationPresenter(Context mContext) {
        this.mContext = mContext;
    }

    @Override
    public void getStageGraduation(JSONObject json) {
        mRxManager.add(mModel.getStageGraduationList(json).subscribe(new RxSubscriber<RxCacheResult<StageGraduationResponse>>(mContext, false) {
            @Override
            protected void _onNext(RxCacheResult<StageGraduationResponse> rxCacheResult) {
                mView.returnStageGraduation(rxCacheResult.getResultModel());
            }

            @Override
            protected void _onError(String message) {

            }
        }));
    }

    @Override
    public void getApplyGraduation(JSONObject json) {
        mRxManager.add(mModel.getApplyGraduationList(json).subscribe(new RxSubscriber<RxCacheResult<ApplyGraduationResponse>>(mContext, false) {
            @Override
            protected void _onNext(RxCacheResult<ApplyGraduationResponse> responseRxCacheResult) {
                mView.returnApplyGraduation(responseRxCacheResult.getResultModel());
            }

            @Override
            protected void _onError(String message) {

            }
        }));
    }
}
